package chapter19_Enum;

import java.util.Collections;

import static chapter19_Enum.Signal.*;

/**
 * Date: 2019/6/18
 * Time: 15:08
 * User: Driss.
 * Description：
 */
public class Pratice1 {

    Signal color = RED;

    public void change(){

        switch (color){
            case RED:
                color = GREEN;
                break;
            case GREEN:
                color = YELLOW;
                break;
            case YELLOW:
                color = RED;
                break;
        }
    }


    public String toString(){
        return "the traffic light is " + color;
    }

    public static void main(String[] args) {
        Pratice1 t = new Pratice1();
        for (int i = 0; i < 7; i++) {
            System.out.println(t);
            t.change();
        }
    }
}
